<?php if(!defined('BASEPATH'))exit('No direct script access allowed'); ?>
<?php $this->load->view('admin/global/header'); ?>
<?php $this->load->view('admin/global/left'); ?>
<table cellpadding="0" cellspacing="0">
    <tr>
        <td class="title"><?php if(isset($notice)){echo lang('EDIT').': '.lang('NOTICE');}else{echo lang('POST').': '.lang('NOTICE');} ?></td>
    </tr>
    <?php if(isset($denied)){ ?>
    <tr>
        <td class="bar">
            <div class="error"><?php echo lang('DENIED'); ?></div>
            <meta http-equiv="refresh" content="5; <?php echo base_url().ADMIN_PATH; ?>" />
        </td>
    </tr>
    <?php }else{ ?>
    <?php if($success == true){ ?>
    <tr>
        <td class="bar">
            <div class="success"><?php echo lang('SUCCESS_UPDATED_DATA'); ?></div>
            <meta http-equiv="refresh" content="1" />
        </td>
    </tr>
    <?php }else{ ?>
    <?php echo Modules::run('admin/bar_module/index', $buttons); ?>
    <tr>
        <td valign="top">
        <form name="frmPost" id="frmPost" method="post">
            <table class="form" align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td class="label"><span class="red">*</span> <?php echo lang('TITLE'); ?>:</td>
                    <td>
                        <input type="text" name="txtTitle" class="input" value="<?php if(isset($notice)){echo set_value('txtTitle', $notice->notTitle);}else{echo set_value('txtTitle');} ?>" />
                        <?php echo form_error('txtTitle'); ?>
                    </td>
                </tr>
                <tr>
                    <td class="label"><?php echo lang('NOTICER'); ?>:</td>
                    <td>
                        <input type="text" name="txtUsername" class="input" value="<?php if(isset($notice)){echo set_value('txtUsername', $notice->useUsername);}else{echo set_value('txtUsername');} ?>" />
                        <img src="<?php echo base_url(); ?>templates/admin/images/tip.jpg" class="tip vtip" title="<?php echo lang('NOTICER_TIP'); ?>" align="top" />
                        <?php echo form_error('txtUsername'); ?>
                    </td>
                </tr>
                <tr>
                    <td class="label" style="padding-top:25px;"><span class="red">*</span> <?php echo lang('GROUP'); ?>:</td>
                    <td>
                        <select name="txtGroup[]" class="select" size="3" multiple="multiple" style="height:65px;">
                            <option value="ALL" <?php if(isset($notice) && trim(strtoupper($notice->notGroup)) == 'ALL'){echo set_select('txtGroup', 'ALL', true);}else{echo set_select('txtGroup', 'ALL');} ?>><?php echo lang('GLOBAL_NOTICE'); ?></option>
                            <?php foreach($groups as $group){ ?>
                            <option value="{(<?php echo $group->groID; ?>)}" <?php if(isset($notice) && trim($notice->notGroup) != '' && stristr($notice->notGroup, '{('.$group->groID.')}') != false){echo set_select('txtGroup', '{('.$group->groID.')}', true);}else{echo set_select('txtGroup', '{('.$group->groID.')}');} ?>><?php echo $group->groName; ?></option>
                            <?php } ?>
                        </select>
                        <?php echo form_error('txtGroup'); ?>
                    </td>
                </tr>
                <tr>
                    <td class="label"><span class="red">*</span> <?php echo lang('LEVEL_NOTICE'); ?>:</td>
                    <td>
                        <select name="txtLevel" class="select">
                            <option value="1" <?php if(isset($notice) && (int)$notice->notLevel == 1){echo set_select('txtLevel', 1, true);}else{echo set_select('txtLevel', 1);} ?>><?php echo lang('NORMAL'); ?></option>
                            <option value="2" <?php if(isset($notice) && (int)$notice->notLevel == 2){echo set_select('txtLevel', 2, true);}else{echo set_select('txtLevel', 2);} ?>><?php echo lang('IMPORTANT'); ?></option>
                            <option value="3" <?php if(isset($notice) && (int)$notice->notLevel == 3){echo set_select('txtLevel', 3, true);}else{echo set_select('txtLevel', 3);} ?>><?php echo lang('EMERGENCY'); ?></option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="labelEditor"><span class="red">*</span> <?php echo lang('DETAIL'); ?></td>
                    <td>
                        <script language="javascript" src="<?php echo base_url(); ?>templates/editor/tiny_mce.js"></script>
                        <script language="javascript" src="<?php echo base_url(); ?>templates/admin/js/editor.js"></script>
                        <textarea name="txtDetail" id="txtDetail" class="textEditor"><?php if(isset($notice)){echo set_value('txtDetail', $notice->notDetail);}else{echo set_value('txtDetail');} ?></textarea>
                        <?php echo form_error('txtDetail'); ?>
                    </td>
                </tr>
                <tr>
                    <td class="label"><span class="red">*</span> <?php echo lang('EXPIRE_DATE'); ?>:</td>
                    <td>
                        <input type="text" name="txtExpireDate" class="inputDate expirePicker" value="<?php if(isset($notice)){echo set_value('txtExpireDate', date_convert($notice->notExpireDate, true, false));}else{echo set_value('txtExpireDate');} ?>" />
                        <span style="margin-left:5px; margin-right:5px;"><b><?php echo lang('OR'); ?></b></span>
                        <select name="txtNumberDate" class="select">
                            <?php for($i = 0; $i <= (EXPIRE_TIME*30); $i++){ ?>
                            <option value="<?php echo $i; ?>" <?php echo set_select('txtNumberDate', $i); ?>><?php echo $i; ?></option>
                            <?php } ?>
                        </select>
                        <span style="margin-left:5px;"><b><?php echo lang('DATE'); ?></b></span>
                        <img src="<?php echo base_url(); ?>templates/admin/images/tip.jpg" class="tip vtip" title="<?php echo lang('EXPIRE_DATE_TIP'); ?>" align="top" />
                        <?php echo form_error('txtExpireDate'); ?>
                    </td>
                </tr>
                <tr>
                    <td class="label0"><?php echo lang('HOME'); ?>:</td>
                    <td>
                        <input type="checkbox" name="txtHome" class="checkbox" value="1" <?php if(isset($notice) && (int)$notice->notHome == 1){echo set_checkbox('txtHome', 1, true);}else{echo set_checkbox('txtHome', 1);} ?> />
                    </td>
                </tr>
                <tr>
                    <td class="label0"><?php echo lang('ACTIVE'); ?>:</td>
                    <td>
                        <input type="checkbox" name="txtStatus" class="checkbox" value="1" <?php if(isset($notice) && (int)$notice->notStatus == 1){echo set_checkbox('txtStatus', 1, true);}else{echo set_checkbox('txtStatus', 1);} ?> />
                    </td>
                </tr>
            </table>
        </form>
        </td>
    </tr>
    <?php } ?>
    <?php } ?>
</table>
<?php $this->load->view('admin/global/right'); ?>
<?php $this->load->view('admin/global/footer'); ?>